import { createSlice, PayloadAction } from "@reduxjs/toolkit";
import store2 from "store2";

const appSlice = createSlice({
  name: "app",
  initialState: {
    collapsed: store2.get("collapsed") || false,
  },
  reducers: {
    setCollapsed(state, { payload }: PayloadAction<boolean>) {
      state.collapsed = payload;
    },
  },
});

export const { setCollapsed } = appSlice.actions;

export default appSlice.reducer;
